#ifndef __AUDIO_ENCODER_H__
#define __AUDIO_ENCODER_H__
#include "stdint.h"
#include "y_ringbuf.h"


#define ENCODER_EVENT (0)

typedef enum
{
	ENCODER_STATE_IDLE,
    ENCODER_STATE_BUSY,
    ENCODER_STATE_MAX,
}Current_Encoder_Status_t;

typedef struct
{
	Current_Encoder_Status_t status;
	RINGBUF_st *pcm_in_ringbuffer;
	RINGBUF_st *encoder_out_ringbuffer;

}Audio_Encode_t;	


#define AUDIO_ENCODE_FRAME_LEN    320
#define ENCODE_RINGBUFFER_LEN	   1024


void audio_encoder_init(void);

void audio_encoder_start(void);

void audio_encoder_stop(void);

bool get_audio_encoder_is_busy(void);
bool get_num_audio_encoder_is_busy(uint8_t num);

bool audio_encoder_src_input(uint8_t*data,uint16_t len);
uint16_t get_audio_encoder_valid_size();

void msg_post_encode_handler();

void audio_speex_encode(uint8_t *in,uint8_t *out,uint16_t *len);
void audio_adpcm_encode(uint8_t *in,uint16_t _in_len,uint8_t *out,uint16_t *out_len);

#endif
